import React, {Component} from 'react';
import "./index.scss"
import {AlertTwoTone, LoadingOutlined, Loading3QuartersOutlined} from '@ant-design/icons';
class Index extends Component {
    state = {
        loading: false
    }

    componentDidMount () {
        this.changeLoading()

    }

    changeLoading = (val) => {
        let {loading} = this.state;
        this.setState({loading: val ? val : !loading})
    }

    refresh = () => {
        // debounce(this.props.refreshTable(),1500)
        this.props.refreshTable()
    }

    render () {
        let {tit} = this.props;
        let {loading} = this.state;
        return (
            <div className="title-module">
                <AlertTwoTone/>
                <div className="text">{tit}</div>
                <span className="icon-end" onClick={this.refresh}>
                    {loading ? <LoadingOutlined/> : <Loading3QuartersOutlined/>}
                </span>
            </div>
        );
    }
}


export default Index;